// use std::path::PathBuf;
use clap::{ Parser};

#[derive(Parser, Debug)]
#[command(name = "rcli", version, author, about, long_about =  None)]
struct CLi{
    // name: Option<String>,

    #[command(subcommand)]
    cmd: SubCommand,



    // #args(short, long, action = clap::ArgAction::Count)
}
#[derive(Debug, Parser)]
enum SubCommand {
    #[command(name = "csv", about = "show csv convert csv to other formats")]
    Csv(CsvOpts),
}
#[derive(Debug, Parser)]
struct CsvOpts {
    #[arg(short, long, value_parser = verify_file_file)]
    input: String,

    #[arg(short, long, default_value = "output.json")]
    ouput: String,

    #[arg(short, long, default_value_t = ',')]
    delimiter: char,

    #[arg(long, long, default_value_t = true)]
    header: bool,
    // #[args(short, long, default_value_t = "input file")]
    // input: String,

}
fn verify_file_file(filename: &str) -> Result<String, String>{
    if std::path::Path::new(filename).exists() {
        Ok(filename.into())
    } else {
        Err("File does not exist".into())
    }
}
fn main() {
    let cli = CLi::parse();
    println!("{:?}", cli);
}